﻿using System;
using ZFine.Application.Gas;
using ZFine.Application.SystemManage;
using ZFine.Code;
using ZFine.Domain.Entity.Gas;
using ZFine.Domain.Entity.SystemManage;
using System.Collections.Generic;
using System.Linq;
using System.Web.Mvc;
using System.Web;
using System.IO;
using NPOI.SS.UserModel;
using NPOI.XSSF.UserModel;
using NPOI.HSSF.UserModel;

namespace ZFine.Web.Areas.Gas.Controllers
{
    public class EduConfigController : ControllerBase
    {
        private EduConfigApp EduConfigApp = new EduConfigApp();

        [HttpGet]
        [HandlerAuthorize(ignore: false)]
        public override ActionResult Index()
        {
            return View();
        }
        [HttpGet]
        [HandlerAuthorize(ignore: false)]
        public ActionResult submitForm()
        {
            return View();
        }
        [HttpGet]
        [HandlerAuthorize(ignore: false)]
        public ActionResult registerForm()
        {
            return View();
        }
        [HandlerAuthorize(ignore: false)]
        public override ActionResult Details()
        {
            return View();
        }
        [HandlerAuthorize(ignore: false)]
        public ActionResult Update()
        {
            return View();
        }
        [HandlerAuthorize(ignore: false)]
        public ActionResult Upload()
        {
            return View();
        }

        [HttpGet]
        [HandlerAjaxOnly]
        public ActionResult GetGridJson(Pagination pagination, EduConfigEntity in_EduConfig)
        {
            List<EduConfigEntity> l_EduConfig = EduConfigApp.GetIQueryable("","").ToList();
            var data = new
            {
                page = pagination.page,//当前页  1  2 3 之类
                records = pagination.records,//总条数  这里应该是18
                rows = l_EduConfig,//分页的数据
                total = pagination.total,//页数
            };
            return Content(data.ToJson());
        }
        //修改页数据
        [HttpGet]
        [HandlerAjaxOnly]
        public ActionResult GetFormJsonForUpdate(string keyValue)
        {
            EduConfigEntity data = EduConfigApp.GetForm(keyValue);
            return Content(data.ToJson());
        }
        //详情页数据
        [HttpGet]
        [HandlerAjaxOnly]
        public ActionResult GetFormJson(string keyValue)
        {
            EduConfigEntity data = EduConfigApp.GetForm(keyValue);
            return Content(data.ToJson());
        }
      
        [HttpPost]
        [HandlerAjaxOnly]
        [ValidateAntiForgeryToken]
        public ActionResult SubmitForm(EduConfigEntity EduConfigEntity, string keyValue)
        {
            EduConfigApp.SubmitForm(EduConfigEntity, keyValue);
            return Success("操作成功。");
        }
        [HttpPost]
        [HandlerAjaxOnly]
        [HandlerAuthorize(ignore: false)]
        [ValidateAntiForgeryToken]
        public ActionResult DeleteForm(string keyValue)
        {
            EduConfigApp.Del(keyValue);
            return Success("删除成功。");
        }
    }
}
